package com.ymttest.database.sqlwapper.shenqirisk;

import java.util.HashMap;
import java.util.List;

import com.ymt.database.SqlManager;
import com.ymttest.database.model.shenqirisk.ShenqiRiskCheck;

public class ShenqiRiskCheckWrapper {
	
	SqlManager manager;

	public ShenqiRiskCheckWrapper() {
		manager = new SqlManager("shenqirisk");
	}

	@SuppressWarnings("unchecked")
	public ShenqiRiskCheck selectByGoodsOwnerIdAndUserId(Long goodsOwnerId,
			Long userId) {

		HashMap<String, Object> map = new HashMap<>();

		map.put("goods_owner_id", goodsOwnerId);
		map.put("user_id", userId);

		List<ShenqiRiskCheck> result = manager
				.getSelectResults(
						"com.ymttest.database.mapping.shenqirisk.ShenqiRiskCheckMapper.selectByGoodsOwnerIdAndUserId",
						map);
		manager.commit();

		if (result.size() == 0)
			return null;

		return result.get(0);
	}
	
	public static void main(String[] args) {
		
		ShenqiRiskCheckWrapper wrapper = new ShenqiRiskCheckWrapper();
		
		System.out.println(wrapper.selectByGoodsOwnerIdAndUserId(500041475L,
				20238699L).getReason());
	}
}
